//
//  GroupTableViewCell.m
//  SimpleTimeDemo
//
//  Created by lanou3g on 15/11/17.
//  Copyright (c) 2015年 王丽珍. All rights reserved.
//

#import "GroupTableViewCell.h"

@implementation GroupTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.userImageView = [[UIImageView alloc] init];
        self.titleLabel = [[UILabel alloc] init];
        self.typeLabel = [[UILabel alloc] init];
        self.joinLabel = [[UILabel alloc] init];
        self.firstButton = [UIButton buttonWithType:UIButtonTypeSystem];
        self.secondButton = [UIButton buttonWithType:UIButtonTypeSystem];
        self.thirdButton = [UIButton buttonWithType:UIButtonTypeSystem];
        self.fourButton = [UIButton buttonWithType:UIButtonTypeSystem];
        self.nameLabel = [[UILabel alloc] init];
        self.timeLabel = [[UILabel alloc] init];
    }
    return self;
}
//@property (strong, nonatomic) IBOutlet UILabel *nameLabel;
//@property (strong, nonatomic) IBOutlet UILabel *timeLabel;
- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.userImageView.frame = CGRectMake(15, 15, 50, 50);
    self.titleLabel.frame = CGRectMake(CGRectGetMaxX(self.userImageView.frame) + 10, CGRectGetMinY(self.userImageView.frame), 100, 30);
    self.typeLabel.frame = CGRectMake(CGRectGetMinX(self.titleLabel.frame), CGRectGetMaxY(self.titleLabel.frame), self.titleLabel.frame.size.width, 20);
    self.typeLabel.backgroundColor = [UIColor greenColor];
    
    self.firstButton.frame = CGRectMake(CGRectGetMinX(self.userImageView.frame), CGRectGetMaxY(self.userImageView.frame) + 10, (self.frame.size.width - 60) / 4, (self.frame.size.width - 60) / 4);
    self.firstButton.backgroundColor = [UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:1];
    self.firstButton.tintColor = [UIColor grayColor];
    self.secondButton.frame = CGRectMake(CGRectGetMaxX(self.firstButton.frame) + 10, CGRectGetMinY(self.firstButton.frame), self.firstButton.frame.size.width, self.firstButton.frame.size.height);
    self.secondButton.backgroundColor = [UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:1];
    self.secondButton.tintColor = [UIColor grayColor];
    self.thirdButton.frame =  CGRectMake(CGRectGetMaxX(self.secondButton.frame) + 10, CGRectGetMinY(self.secondButton.frame), self.firstButton.frame.size.width, self.firstButton.frame.size.height);
    self.thirdButton.backgroundColor = [UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:1];
    self.thirdButton.tintColor = [UIColor grayColor];
    self.fourButton.frame =  CGRectMake(CGRectGetMaxX(self.thirdButton.frame) + 10, CGRectGetMinY(self.thirdButton.frame), self.firstButton.frame.size.width, self.firstButton.frame.size.height);
    self.fourButton.backgroundColor = [UIColor colorWithRed:0.2 green:0.2 blue:0.2 alpha:1];
    self.fourButton.tintColor = [UIColor grayColor];
    
    self.joinLabel.frame = CGRectMake(CGRectGetMaxX(self.fourButton.frame) - 100, CGRectGetMinY(self.typeLabel.frame), 100, self.typeLabel.frame.size.height);
    
    self.nameLabel.frame = CGRectMake(CGRectGetMinX(self.firstButton.frame), CGRectGetMaxY(self.firstButton.frame) + 10, 100, 20);
    self.timeLabel.frame = CGRectMake(CGRectGetMaxX(self.fourButton.frame) - 100, CGRectGetMinY(self.nameLabel.frame), 100, self.nameLabel.frame.size.height);
    
    [self.contentView addSubview:self.userImageView];
    [self.contentView addSubview:self.titleLabel];
    [self.contentView addSubview:self.typeLabel];
    [self.contentView addSubview:self.joinLabel];
    
    [self.contentView addSubview:self.firstButton];
    [self.contentView addSubview:self.secondButton];
    [self.contentView addSubview:self.thirdButton];
    [self.contentView addSubview:self.fourButton];
    
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.timeLabel];
}




- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
